1. Field of the Invention
The present invention relates generally to managing data and resources in a database. More specifically, the present invention relates to a computer implemented method and computer usable program code for rapidly deleting rows of a database while logging details concerning deletion of the rows.
2. Description of the Related Art
The largest hierarchical structure of a database is the table. When a user creates a table, the table is empty. Later, a user may add one or more rows to a table. A row is at least one value. A database management system arranges values in fields. A field is an open storage space that is large enough to accommodate expected data. Often a field is limited to a particular type, such as a date, or a negative numeric value, or an alphanumeric string, among other types of data or information. The database management system organizes fields within different rows. The database management system organizes each field that represents the same type of data for a set of rows into a column of that same type of data.
Periodically, users may remove large amounts of data from a database, usually by deleting multiple rows of data from the database. Reasons for deleting large amounts of data from databases vary. For example, users delete data to eliminate obsolete data. Sometimes users delete data in response to receiving new data when the free space or storage in a database is exhausted. This strategy usually is preferred to the strategy of adding more disk storage to accommodate new data.
Another occasion to delete data from a database occurs when an enterprise stops doing business in a certain area. For example, a database may include rows with a tract of data related to Region A. The enterprise may stop doing business in Region A. As a result, a user may wish to delete all rows where a region field corresponds to “Region A.”
Existing methods for deleting database records include the step of a database management system deleting a row. Next, the database management system logs details of the delete step to a delete log. This logging continues even for bulk operations where many rows are deleted by a common request. Consequently, a great number of delete logs can be created. Managing a great number of delete logs is burdensome because an undesirable amount of time is required to manage the delete logs and because an undesirable amount of storage space may be used to store the delete logs. Lengthy delete logs may also slow processes down when a user attempts to recover data previously deleted. A database management system operates slower when an unnecessarily large delete log is used to recover data previously deleted.
An example of an existing method for deleting database records and logging deletion of the records is as follows. A user commands a database management system to delete data. The user composes the command as a transaction that includes a delete request. The delete request includes a condition that permits the database management system to qualify a row based on whether the row has a column or field that stores a value that meets the condition. When a field in the row meets the condition, the row qualifies. Under conventional methods, selected fields of each row are tested. A database management system continues testing subsequent rows in this manner. For each qualifying test of each row, the database management system deletes a qualifying row and logs the change to a delete log.